{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "8017151b",
   "metadata": {},
   "source": [
    "* 20022/9/26 week06\n",
    "* python学习记录"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a57566d6",
   "metadata": {},
   "source": [
    "# 本周知识点\n",
    ">1. 随机函数\n",
    ">2. 时间函数"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d3ffe2f1",
   "metadata": {},
   "source": [
    "# 1.随机函数\n",
    ">1. random.random(:生成随机数\n",
    ">2. random.randint():生成随机数\n",
    ">3. random.choices():随机抽样"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "57cb9806",
   "metadata": {},
   "outputs": [],
   "source": [
    "import random"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "c8b14f70",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on built-in function random:\n",
      "\n",
      "random() method of random.Random instance\n",
      "    random() -> x in the interval [0, 1).\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(random.random)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "ce9a1c56",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.1770275885961311"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "random.random()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "8a84ea3d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on method randint in module random:\n",
      "\n",
      "randint(a, b) method of random.Random instance\n",
      "    Return random integer in range [a, b], including both end points.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(random.randint)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "e1188d16",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "31"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "random.randint(0,100) #整数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "90faecc7",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5\n",
      "1\n",
      "6\n",
      "3\n",
      "6\n"
     ]
    }
   ],
   "source": [
    "# randint 小实践: 大话骰\n",
    "for i in range(5):\n",
    "    print(random.randint(1,6))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "43290643",
   "metadata": {},
   "outputs": [],
   "source": [
    "# randint小实践: 猜数字, 0-100"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "35185d87",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Lihua'"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# random.choice(),在数据组（列表）随机选择一个值\n",
    "random.choice([\"Alex\",\"Xiaohong\",\"Lihua\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "a5b854c7",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "96\n",
      "30\n",
      "30\n",
      "60\n",
      "49\n",
      "38\n"
     ]
    }
   ],
   "source": [
    "# 通过随机值，大概去判断一下彩票的中奖概率\n",
    "[12,34,65,10,22,12]\n",
    "for i in range(6):\n",
    "    print(random.randint(0,99))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "de9df08b",
   "metadata": {},
   "source": [
    "# 时间函数time（）\n",
    "* 时间延迟函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "85e2b3e0",
   "metadata": {},
   "outputs": [],
   "source": [
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "7606d83f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "time.struct_time(tm_year=2022, tm_mon=10, tm_mday=22, tm_hour=12, tm_min=57, tm_sec=22, tm_wday=5, tm_yday=295, tm_isdst=0)"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.localtime()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "3b2fcea0",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on built-in function sleep in module time:\n",
      "\n",
      "sleep(...)\n",
      "    sleep(seconds)\n",
      "    \n",
      "    Delay execution for a given number of seconds.  The argument may be\n",
      "    a floating point number for subsecond precision.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(time.sleep)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "b09ede17",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hello world\n"
     ]
    }
   ],
   "source": [
    "time.sleep(2)\n",
    "print(\"hello world\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "21b45f2a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "数据获取...\n",
      "页面停留 4 秒\n",
      "继续下一页\n",
      "数据获取...\n",
      "页面停留 3 秒\n",
      "继续下一页\n",
      "数据获取...\n",
      "页面停留 3 秒\n",
      "继续下一页\n",
      "数据获取...\n",
      "页面停留 9 秒\n",
      "继续下一页\n",
      "数据获取...\n",
      "页面停留 4 秒\n",
      "继续下一页\n"
     ]
    }
   ],
   "source": [
    "# 实践: 浏览抓取网页数据，模拟人的行为，让机器慢下来， 每执行一次休息3秒钟，\n",
    "#        进阶: 随机产生一个数， 让程序停留随机的秒数\n",
    "for i in range(5):\n",
    "    print(\"数据获取...\")\n",
    "    wait_time = random.randint(3,10)\n",
    "    print(\"页面停留\",wait_time,\"秒\")\n",
    "    time.sleep(wait_time)\n",
    "    print(\"继续下一页\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "d9463559",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'range_this_seconds' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[1;32mIn [30], line 9\u001b[0m\n\u001b[0;32m      7\u001b[0m right_this_seconds \u001b[38;5;241m=\u001b[39m datetime\u001b[38;5;241m.\u001b[39mdatetime\u001b[38;5;241m.\u001b[39mtoday()\u001b[38;5;241m.\u001b[39msecond\n\u001b[0;32m      8\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m right_this_seconds \u001b[38;5;129;01min\u001b[39;00m odds:\n\u001b[1;32m----> 9\u001b[0m     \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m当前是奇数秒\u001b[39m\u001b[38;5;124m\"\u001b[39m,range_this_seconds)\n\u001b[0;32m     10\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m     11\u001b[0m     \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m当前是偶数秒\u001b[39m\u001b[38;5;124m\"\u001b[39m,range_this_seconds)\n",
      "\u001b[1;31mNameError\u001b[0m: name 'range_this_seconds' is not defined"
     ]
    }
   ],
   "source": [
    "import datetime\n",
    "import time,random\n",
    "\n",
    "odds = [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59]\n",
    "\n",
    "for i in range(5): \n",
    "    right_this_seconds = datetime.datetime.today().second\n",
    "    if right_this_seconds in odds:\n",
    "        print(\"当前是奇数秒\",range_this_seconds)\n",
    "    else:\n",
    "        print(\"当前是偶数秒\",range_this_seconds)\n",
    "    wait_time = random.randint(1,20)\n",
    "    print(\"等待时间(随机)：\",wait_time)\n",
    "    time.sleep(wait_time)\n",
    "    print(\"------------\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "98bdf875",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "99 bottles 在啤酒墙上~~\n",
      "99 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "98 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "98 bottles 在啤酒墙上~~\n",
      "98 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "97 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "97 bottles 在啤酒墙上~~\n",
      "97 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "96 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "96 bottles 在啤酒墙上~~\n",
      "96 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "95 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "95 bottles 在啤酒墙上~~\n",
      "95 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "94 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "94 bottles 在啤酒墙上~~\n",
      "94 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "93 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "93 bottles 在啤酒墙上~~\n",
      "93 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "92 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "92 bottles 在啤酒墙上~~\n",
      "92 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "91 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "91 bottles 在啤酒墙上~~\n",
      "91 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "90 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "90 bottles 在啤酒墙上~~\n",
      "90 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "89 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "89 bottles 在啤酒墙上~~\n",
      "89 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "88 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "88 bottles 在啤酒墙上~~\n",
      "88 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "87 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "87 bottles 在啤酒墙上~~\n",
      "87 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "86 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "86 bottles 在啤酒墙上~~\n",
      "86 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "85 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "85 bottles 在啤酒墙上~~\n",
      "85 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "84 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "84 bottles 在啤酒墙上~~\n",
      "84 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "83 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "83 bottles 在啤酒墙上~~\n",
      "83 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "82 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "82 bottles 在啤酒墙上~~\n",
      "82 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "81 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "81 bottles 在啤酒墙上~~\n",
      "81 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "80 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "80 bottles 在啤酒墙上~~\n",
      "80 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "79 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "79 bottles 在啤酒墙上~~\n",
      "79 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "78 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "78 bottles 在啤酒墙上~~\n",
      "78 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "77 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "77 bottles 在啤酒墙上~~\n",
      "77 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "76 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "76 bottles 在啤酒墙上~~\n",
      "76 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "75 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "75 bottles 在啤酒墙上~~\n",
      "75 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "74 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "74 bottles 在啤酒墙上~~\n",
      "74 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "73 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "73 bottles 在啤酒墙上~~\n",
      "73 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "72 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "72 bottles 在啤酒墙上~~\n",
      "72 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "71 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "71 bottles 在啤酒墙上~~\n",
      "71 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "70 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "70 bottles 在啤酒墙上~~\n",
      "70 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "69 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "69 bottles 在啤酒墙上~~\n",
      "69 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "68 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "68 bottles 在啤酒墙上~~\n",
      "68 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "67 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "67 bottles 在啤酒墙上~~\n",
      "67 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "66 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "66 bottles 在啤酒墙上~~\n",
      "66 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "65 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "65 bottles 在啤酒墙上~~\n",
      "65 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "64 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "64 bottles 在啤酒墙上~~\n",
      "64 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "63 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "63 bottles 在啤酒墙上~~\n",
      "63 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "62 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "62 bottles 在啤酒墙上~~\n",
      "62 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "61 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "61 bottles 在啤酒墙上~~\n",
      "61 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "60 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "60 bottles 在啤酒墙上~~\n",
      "60 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "59 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "59 bottles 在啤酒墙上~~\n",
      "59 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "58 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "58 bottles 在啤酒墙上~~\n",
      "58 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "57 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "57 bottles 在啤酒墙上~~\n",
      "57 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "56 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "56 bottles 在啤酒墙上~~\n",
      "56 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "55 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "55 bottles 在啤酒墙上~~\n",
      "55 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "54 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "54 bottles 在啤酒墙上~~\n",
      "54 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "53 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "53 bottles 在啤酒墙上~~\n",
      "53 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "52 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "52 bottles 在啤酒墙上~~\n",
      "52 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "51 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "51 bottles 在啤酒墙上~~\n",
      "51 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "50 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "50 bottles 在啤酒墙上~~\n",
      "50 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "49 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "49 bottles 在啤酒墙上~~\n",
      "49 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "48 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "48 bottles 在啤酒墙上~~\n",
      "48 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "47 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "47 bottles 在啤酒墙上~~\n",
      "47 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "46 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "46 bottles 在啤酒墙上~~\n",
      "46 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "45 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "45 bottles 在啤酒墙上~~\n",
      "45 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "44 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "44 bottles 在啤酒墙上~~\n",
      "44 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "43 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "43 bottles 在啤酒墙上~~\n",
      "43 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "42 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "42 bottles 在啤酒墙上~~\n",
      "42 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "41 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "41 bottles 在啤酒墙上~~\n",
      "41 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "40 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "40 bottles 在啤酒墙上~~\n",
      "40 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "39 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "39 bottles 在啤酒墙上~~\n",
      "39 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "38 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "38 bottles 在啤酒墙上~~\n",
      "38 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "37 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "37 bottles 在啤酒墙上~~\n",
      "37 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "36 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "36 bottles 在啤酒墙上~~\n",
      "36 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "35 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "35 bottles 在啤酒墙上~~\n",
      "35 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "34 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "34 bottles 在啤酒墙上~~\n",
      "34 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "33 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "33 bottles 在啤酒墙上~~\n",
      "33 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "32 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "32 bottles 在啤酒墙上~~\n",
      "32 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "31 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "31 bottles 在啤酒墙上~~\n",
      "31 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "30 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "30 bottles 在啤酒墙上~~\n",
      "30 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "29 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "29 bottles 在啤酒墙上~~\n",
      "29 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "28 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "28 bottles 在啤酒墙上~~\n",
      "28 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "27 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "27 bottles 在啤酒墙上~~\n",
      "27 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "26 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "26 bottles 在啤酒墙上~~\n",
      "26 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "25 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "25 bottles 在啤酒墙上~~\n",
      "25 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "24 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "24 bottles 在啤酒墙上~~\n",
      "24 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "23 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "23 bottles 在啤酒墙上~~\n",
      "23 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "22 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "22 bottles 在啤酒墙上~~\n",
      "22 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "21 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "21 bottles 在啤酒墙上~~\n",
      "21 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "20 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "20 bottles 在啤酒墙上~~\n",
      "20 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "19 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "19 bottles 在啤酒墙上~~\n",
      "19 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "18 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "18 bottles 在啤酒墙上~~\n",
      "18 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "17 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "17 bottles 在啤酒墙上~~\n",
      "17 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "16 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "16 bottles 在啤酒墙上~~\n",
      "16 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "15 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "15 bottles 在啤酒墙上~~\n",
      "15 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "14 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "14 bottles 在啤酒墙上~~\n",
      "14 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "13 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "13 bottles 在啤酒墙上~~\n",
      "13 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "12 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "12 bottles 在啤酒墙上~~\n",
      "12 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "11 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "11 bottles 在啤酒墙上~~\n",
      "11 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "10 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "10 bottles 在啤酒墙上~~\n",
      "10 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "9 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "9 bottles 在啤酒墙上~~\n",
      "9 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "8 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "8 bottles 在啤酒墙上~~\n",
      "8 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "7 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "7 bottles 在啤酒墙上~~\n",
      "7 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "6 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "6 bottles 在啤酒墙上~~\n",
      "6 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "5 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "5 bottles 在啤酒墙上~~\n",
      "5 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "4 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "4 bottles 在啤酒墙上~~\n",
      "4 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "3 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "3 bottles 在啤酒墙上~~\n",
      "3 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "2 bottles 在啤酒墙上~~\n",
      "--------------\n",
      "2 bottles 在啤酒墙上~~\n",
      "2 bottles 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "1 bottle 在啤酒墙上~~\n",
      "--------------\n",
      "1 bottle 在啤酒墙上~~\n",
      "1 bottle 啤酒~~\n",
      "拿下来一瓶给我吧~~\n",
      "啤酒被拿走了一瓶~~\n",
      "只剩一瓶了，不能给你了，要放在墙上展示\n",
      "--------------\n"
     ]
    }
   ],
   "source": [
    "beer_name = \"bottles\"\n",
    "\n",
    "for beer_num in range(99,0,-1):\n",
    "    print(beer_num,beer_name,\"在啤酒墙上~~\")\n",
    "    print(beer_num,beer_name,\"啤酒~~\")\n",
    "    print(\"拿下来一瓶给我吧~~\")\n",
    "    print(\"啤酒被拿走了一瓶~~\")\n",
    "    # 情况一：只剩下一瓶的情况：\n",
    "    if beer_num == 1:\n",
    "        print(\"只剩一瓶了，不能给你了，要放在墙上展示\")\n",
    "    # 情况二：还有多于一瓶的情况\n",
    "    else:\n",
    "        new_num = beer_num -1\n",
    "        if new_num ==1:\n",
    "            beer_name = \"bottle\"\n",
    "        print(new_num,beer_name,\"在啤酒墙上~~\")\n",
    "    print(\"--------------\")\n",
    "          "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "527865b4",
   "metadata": {},
   "source": [
    "# 3.有序的数据结构（）\n",
    ">1. 数值\n",
    ">>1. 数值的运算\n",
    "\n",
    ">2. 字符串\n",
    ">3. 列表，元组，字典，“集合”（期中考核）p144前"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "3fa1413e",
   "metadata": {},
   "outputs": [],
   "source": [
    "### 3.0数值的类型"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "71fad91c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "### 3.1数值的基本运算\n",
    "\n",
    "2+2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "56a07987",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "69a17f0d",
   "metadata": {},
   "outputs": [
    {
     "ename": "URLError",
     "evalue": "<urlopen error [Errno 11001] getaddrinfo failed>",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mgaierror\u001b[0m                                  Traceback (most recent call last)",
      "File \u001b[1;32mD:\\anconda\\lib\\urllib\\request.py:1346\u001b[0m, in \u001b[0;36mAbstractHTTPHandler.do_open\u001b[1;34m(self, http_class, req, **http_conn_args)\u001b[0m\n\u001b[0;32m   1345\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m-> 1346\u001b[0m     \u001b[43mh\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\u001b[43mreq\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_method\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mreq\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mselector\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mreq\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdata\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m   1347\u001b[0m \u001b[43m              \u001b[49m\u001b[43mencode_chunked\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mreq\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mhas_header\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mTransfer-encoding\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m   1348\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mOSError\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m err: \u001b[38;5;66;03m# timeout error\u001b[39;00m\n",
      "File \u001b[1;32mD:\\anconda\\lib\\http\\client.py:1285\u001b[0m, in \u001b[0;36mHTTPConnection.request\u001b[1;34m(self, method, url, body, headers, encode_chunked)\u001b[0m\n\u001b[0;32m   1284\u001b[0m \u001b[38;5;124;03m\"\"\"Send a complete request to the server.\"\"\"\u001b[39;00m\n\u001b[1;32m-> 1285\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_send_request\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mencode_chunked\u001b[49m\u001b[43m)\u001b[49m\n",
      "File \u001b[1;32mD:\\anconda\\lib\\http\\client.py:1331\u001b[0m, in \u001b[0;36mHTTPConnection._send_request\u001b[1;34m(self, method, url, body, headers, encode_chunked)\u001b[0m\n\u001b[0;32m   1330\u001b[0m     body \u001b[38;5;241m=\u001b[39m _encode(body, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mbody\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m-> 1331\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mendheaders\u001b[49m\u001b[43m(\u001b[49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mencode_chunked\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mencode_chunked\u001b[49m\u001b[43m)\u001b[49m\n",
      "File \u001b[1;32mD:\\anconda\\lib\\http\\client.py:1280\u001b[0m, in \u001b[0;36mHTTPConnection.endheaders\u001b[1;34m(self, message_body, encode_chunked)\u001b[0m\n\u001b[0;32m   1279\u001b[0m     \u001b[38;5;28;01mraise\u001b[39;00m CannotSendHeader()\n\u001b[1;32m-> 1280\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_send_output\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmessage_body\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mencode_chunked\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mencode_chunked\u001b[49m\u001b[43m)\u001b[49m\n",
      "File \u001b[1;32mD:\\anconda\\lib\\http\\client.py:1040\u001b[0m, in \u001b[0;36mHTTPConnection._send_output\u001b[1;34m(self, message_body, encode_chunked)\u001b[0m\n\u001b[0;32m   1039\u001b[0m \u001b[38;5;28;01mdel\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_buffer[:]\n\u001b[1;32m-> 1040\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmsg\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m   1042\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m message_body \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m   1043\u001b[0m \n\u001b[0;32m   1044\u001b[0m     \u001b[38;5;66;03m# create a consistent interface to message_body\u001b[39;00m\n",
      "File \u001b[1;32mD:\\anconda\\lib\\http\\client.py:980\u001b[0m, in \u001b[0;36mHTTPConnection.send\u001b[1;34m(self, data)\u001b[0m\n\u001b[0;32m    979\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mauto_open:\n\u001b[1;32m--> 980\u001b[0m     \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mconnect\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m    981\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n",
      "File \u001b[1;32mD:\\anconda\\lib\\http\\client.py:1447\u001b[0m, in \u001b[0;36mHTTPSConnection.connect\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m   1445\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mConnect to a host on a given (SSL) port.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m-> 1447\u001b[0m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mconnect\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m   1449\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_tunnel_host:\n",
      "File \u001b[1;32mD:\\anconda\\lib\\http\\client.py:946\u001b[0m, in \u001b[0;36mHTTPConnection.connect\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m    945\u001b[0m \u001b[38;5;124;03m\"\"\"Connect to the host and port specified in __init__.\"\"\"\u001b[39;00m\n\u001b[1;32m--> 946\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msock \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_create_connection\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m    947\u001b[0m \u001b[43m    \u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mhost\u001b[49m\u001b[43m,\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mport\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msource_address\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m    948\u001b[0m \u001b[38;5;66;03m# Might fail in OSs that don't implement TCP_NODELAY\u001b[39;00m\n",
      "File \u001b[1;32mD:\\anconda\\lib\\socket.py:823\u001b[0m, in \u001b[0;36mcreate_connection\u001b[1;34m(address, timeout, source_address)\u001b[0m\n\u001b[0;32m    822\u001b[0m err \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m--> 823\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m res \u001b[38;5;129;01min\u001b[39;00m \u001b[43mgetaddrinfo\u001b[49m\u001b[43m(\u001b[49m\u001b[43mhost\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mport\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mSOCK_STREAM\u001b[49m\u001b[43m)\u001b[49m:\n\u001b[0;32m    824\u001b[0m     af, socktype, proto, canonname, sa \u001b[38;5;241m=\u001b[39m res\n",
      "File \u001b[1;32mD:\\anconda\\lib\\socket.py:954\u001b[0m, in \u001b[0;36mgetaddrinfo\u001b[1;34m(host, port, family, type, proto, flags)\u001b[0m\n\u001b[0;32m    953\u001b[0m addrlist \u001b[38;5;241m=\u001b[39m []\n\u001b[1;32m--> 954\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m res \u001b[38;5;129;01min\u001b[39;00m \u001b[43m_socket\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetaddrinfo\u001b[49m\u001b[43m(\u001b[49m\u001b[43mhost\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mport\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfamily\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mtype\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mproto\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mflags\u001b[49m\u001b[43m)\u001b[49m:\n\u001b[0;32m    955\u001b[0m     af, socktype, proto, canonname, sa \u001b[38;5;241m=\u001b[39m res\n",
      "\u001b[1;31mgaierror\u001b[0m: [Errno 11001] getaddrinfo failed",
      "\nDuring handling of the above exception, another exception occurred:\n",
      "\u001b[1;31mURLError\u001b[0m                                  Traceback (most recent call last)",
      "Cell \u001b[1;32mIn [35], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m pd\u001b[38;5;241m.\u001b[39mread_html(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mhttps://docs.python.org/zh-cn/3/library/stdtypes.html#numeric-types-int-float-complex\u001b[39m\u001b[38;5;124m\"\u001b[39m)[\u001b[38;5;241m2\u001b[39m]\n",
      "File \u001b[1;32mD:\\anconda\\lib\\site-packages\\pandas\\util\\_decorators.py:311\u001b[0m, in \u001b[0;36mdeprecate_nonkeyword_arguments.<locals>.decorate.<locals>.wrapper\u001b[1;34m(*args, **kwargs)\u001b[0m\n\u001b[0;32m    305\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(args) \u001b[38;5;241m>\u001b[39m num_allow_args:\n\u001b[0;32m    306\u001b[0m     warnings\u001b[38;5;241m.\u001b[39mwarn(\n\u001b[0;32m    307\u001b[0m         msg\u001b[38;5;241m.\u001b[39mformat(arguments\u001b[38;5;241m=\u001b[39marguments),\n\u001b[0;32m    308\u001b[0m         \u001b[38;5;167;01mFutureWarning\u001b[39;00m,\n\u001b[0;32m    309\u001b[0m         stacklevel\u001b[38;5;241m=\u001b[39mstacklevel,\n\u001b[0;32m    310\u001b[0m     )\n\u001b[1;32m--> 311\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m func(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n",
      "File \u001b[1;32mD:\\anconda\\lib\\site-packages\\pandas\\io\\html.py:1113\u001b[0m, in \u001b[0;36mread_html\u001b[1;34m(io, match, flavor, header, index_col, skiprows, attrs, parse_dates, thousands, encoding, decimal, converters, na_values, keep_default_na, displayed_only)\u001b[0m\n\u001b[0;32m   1109\u001b[0m validate_header_arg(header)\n\u001b[0;32m   1111\u001b[0m io \u001b[38;5;241m=\u001b[39m stringify_path(io)\n\u001b[1;32m-> 1113\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_parse\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m   1114\u001b[0m \u001b[43m    \u001b[49m\u001b[43mflavor\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mflavor\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m   1115\u001b[0m \u001b[43m    \u001b[49m\u001b[43mio\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mio\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m   1116\u001b[0m \u001b[43m    \u001b[49m\u001b[43mmatch\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmatch\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m   1117\u001b[0m \u001b[43m    \u001b[49m\u001b[43mheader\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mheader\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m   1118\u001b[0m \u001b[43m    \u001b[49m\u001b[43mindex_col\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mindex_col\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m   1119\u001b[0m \u001b[43m    \u001b[49m\u001b[43mskiprows\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mskiprows\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m   1120\u001b[0m \u001b[43m    \u001b[49m\u001b[43mparse_dates\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mparse_dates\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m   1121\u001b[0m \u001b[43m    \u001b[49m\u001b[43mthousands\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mthousands\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m   1122\u001b[0m \u001b[43m    \u001b[49m\u001b[43mattrs\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mattrs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m   1123\u001b[0m \u001b[43m    \u001b[49m\u001b[43mencoding\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mencoding\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m   1124\u001b[0m \u001b[43m    \u001b[49m\u001b[43mdecimal\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdecimal\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m   1125\u001b[0m \u001b[43m    \u001b[49m\u001b[43mconverters\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mconverters\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m   1126\u001b[0m \u001b[43m    \u001b[49m\u001b[43mna_values\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mna_values\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m   1127\u001b[0m \u001b[43m    \u001b[49m\u001b[43mkeep_default_na\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mkeep_default_na\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m   1128\u001b[0m \u001b[43m    \u001b[49m\u001b[43mdisplayed_only\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdisplayed_only\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m   1129\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n",
      "File \u001b[1;32mD:\\anconda\\lib\\site-packages\\pandas\\io\\html.py:919\u001b[0m, in \u001b[0;36m_parse\u001b[1;34m(flavor, io, match, attrs, encoding, displayed_only, **kwargs)\u001b[0m\n\u001b[0;32m    916\u001b[0m p \u001b[38;5;241m=\u001b[39m parser(io, compiled_match, attrs, encoding, displayed_only)\n\u001b[0;32m    918\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 919\u001b[0m     tables \u001b[38;5;241m=\u001b[39m \u001b[43mp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mparse_tables\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m    920\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m caught:\n\u001b[0;32m    921\u001b[0m     \u001b[38;5;66;03m# if `io` is an io-like object, check if it's seekable\u001b[39;00m\n\u001b[0;32m    922\u001b[0m     \u001b[38;5;66;03m# and try to rewind it before trying the next parser\u001b[39;00m\n\u001b[0;32m    923\u001b[0m     \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mhasattr\u001b[39m(io, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mseekable\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;129;01mand\u001b[39;00m io\u001b[38;5;241m.\u001b[39mseekable():\n",
      "File \u001b[1;32mD:\\anconda\\lib\\site-packages\\pandas\\io\\html.py:239\u001b[0m, in \u001b[0;36m_HtmlFrameParser.parse_tables\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m    231\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mparse_tables\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[0;32m    232\u001b[0m     \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m    233\u001b[0m \u001b[38;5;124;03m    Parse and return all tables from the DOM.\u001b[39;00m\n\u001b[0;32m    234\u001b[0m \n\u001b[1;32m   (...)\u001b[0m\n\u001b[0;32m    237\u001b[0m \u001b[38;5;124;03m    list of parsed (header, body, footer) tuples from tables.\u001b[39;00m\n\u001b[0;32m    238\u001b[0m \u001b[38;5;124;03m    \"\"\"\u001b[39;00m\n\u001b[1;32m--> 239\u001b[0m     tables \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_parse_tables(\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_build_doc\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmatch, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mattrs)\n\u001b[0;32m    240\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_parse_thead_tbody_tfoot(table) \u001b[38;5;28;01mfor\u001b[39;00m table \u001b[38;5;129;01min\u001b[39;00m tables)\n",
      "File \u001b[1;32mD:\\anconda\\lib\\site-packages\\pandas\\io\\html.py:758\u001b[0m, in \u001b[0;36m_LxmlFrameParser._build_doc\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m    756\u001b[0m             \u001b[38;5;28;01mpass\u001b[39;00m\n\u001b[0;32m    757\u001b[0m     \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 758\u001b[0m         \u001b[38;5;28;01mraise\u001b[39;00m e\n\u001b[0;32m    759\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m    760\u001b[0m     \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mhasattr\u001b[39m(r, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtext_content\u001b[39m\u001b[38;5;124m\"\u001b[39m):\n",
      "File \u001b[1;32mD:\\anconda\\lib\\site-packages\\pandas\\io\\html.py:739\u001b[0m, in \u001b[0;36m_LxmlFrameParser._build_doc\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m    737\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m    738\u001b[0m     \u001b[38;5;28;01mif\u001b[39;00m is_url(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mio):\n\u001b[1;32m--> 739\u001b[0m         \u001b[38;5;28;01mwith\u001b[39;00m \u001b[43murlopen\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mio\u001b[49m\u001b[43m)\u001b[49m \u001b[38;5;28;01mas\u001b[39;00m f:\n\u001b[0;32m    740\u001b[0m             r \u001b[38;5;241m=\u001b[39m parse(f, parser\u001b[38;5;241m=\u001b[39mparser)\n\u001b[0;32m    741\u001b[0m     \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m    742\u001b[0m         \u001b[38;5;66;03m# try to parse the input in the simplest way\u001b[39;00m\n",
      "File \u001b[1;32mD:\\anconda\\lib\\site-packages\\pandas\\io\\common.py:239\u001b[0m, in \u001b[0;36murlopen\u001b[1;34m(*args, **kwargs)\u001b[0m\n\u001b[0;32m    233\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m    234\u001b[0m \u001b[38;5;124;03mLazy-import wrapper for stdlib urlopen, as that imports a big chunk of\u001b[39;00m\n\u001b[0;32m    235\u001b[0m \u001b[38;5;124;03mthe stdlib.\u001b[39;00m\n\u001b[0;32m    236\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m    237\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01murllib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mrequest\u001b[39;00m\n\u001b[1;32m--> 239\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m urllib\u001b[38;5;241m.\u001b[39mrequest\u001b[38;5;241m.\u001b[39murlopen(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n",
      "File \u001b[1;32mD:\\anconda\\lib\\urllib\\request.py:214\u001b[0m, in \u001b[0;36murlopen\u001b[1;34m(url, data, timeout, cafile, capath, cadefault, context)\u001b[0m\n\u001b[0;32m    212\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m    213\u001b[0m     opener \u001b[38;5;241m=\u001b[39m _opener\n\u001b[1;32m--> 214\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mopener\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mopen\u001b[49m\u001b[43m(\u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdata\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m)\u001b[49m\n",
      "File \u001b[1;32mD:\\anconda\\lib\\urllib\\request.py:517\u001b[0m, in \u001b[0;36mOpenerDirector.open\u001b[1;34m(self, fullurl, data, timeout)\u001b[0m\n\u001b[0;32m    514\u001b[0m     req \u001b[38;5;241m=\u001b[39m meth(req)\n\u001b[0;32m    516\u001b[0m sys\u001b[38;5;241m.\u001b[39maudit(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124murllib.Request\u001b[39m\u001b[38;5;124m'\u001b[39m, req\u001b[38;5;241m.\u001b[39mfull_url, req\u001b[38;5;241m.\u001b[39mdata, req\u001b[38;5;241m.\u001b[39mheaders, req\u001b[38;5;241m.\u001b[39mget_method())\n\u001b[1;32m--> 517\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_open\u001b[49m\u001b[43m(\u001b[49m\u001b[43mreq\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdata\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m    519\u001b[0m \u001b[38;5;66;03m# post-process response\u001b[39;00m\n\u001b[0;32m    520\u001b[0m meth_name \u001b[38;5;241m=\u001b[39m protocol\u001b[38;5;241m+\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m_response\u001b[39m\u001b[38;5;124m\"\u001b[39m\n",
      "File \u001b[1;32mD:\\anconda\\lib\\urllib\\request.py:534\u001b[0m, in \u001b[0;36mOpenerDirector._open\u001b[1;34m(self, req, data)\u001b[0m\n\u001b[0;32m    531\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m result\n\u001b[0;32m    533\u001b[0m protocol \u001b[38;5;241m=\u001b[39m req\u001b[38;5;241m.\u001b[39mtype\n\u001b[1;32m--> 534\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_chain\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mhandle_open\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mprotocol\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mprotocol\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m+\u001b[39;49m\n\u001b[0;32m    535\u001b[0m \u001b[43m                          \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43m_open\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mreq\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m    536\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m result:\n\u001b[0;32m    537\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m result\n",
      "File \u001b[1;32mD:\\anconda\\lib\\urllib\\request.py:494\u001b[0m, in \u001b[0;36mOpenerDirector._call_chain\u001b[1;34m(self, chain, kind, meth_name, *args)\u001b[0m\n\u001b[0;32m    492\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m handler \u001b[38;5;129;01min\u001b[39;00m handlers:\n\u001b[0;32m    493\u001b[0m     func \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mgetattr\u001b[39m(handler, meth_name)\n\u001b[1;32m--> 494\u001b[0m     result \u001b[38;5;241m=\u001b[39m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m    495\u001b[0m     \u001b[38;5;28;01mif\u001b[39;00m result \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m    496\u001b[0m         \u001b[38;5;28;01mreturn\u001b[39;00m result\n",
      "File \u001b[1;32mD:\\anconda\\lib\\urllib\\request.py:1389\u001b[0m, in \u001b[0;36mHTTPSHandler.https_open\u001b[1;34m(self, req)\u001b[0m\n\u001b[0;32m   1388\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mhttps_open\u001b[39m(\u001b[38;5;28mself\u001b[39m, req):\n\u001b[1;32m-> 1389\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdo_open\u001b[49m\u001b[43m(\u001b[49m\u001b[43mhttp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mclient\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mHTTPSConnection\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mreq\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m   1390\u001b[0m \u001b[43m        \u001b[49m\u001b[43mcontext\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_context\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcheck_hostname\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_check_hostname\u001b[49m\u001b[43m)\u001b[49m\n",
      "File \u001b[1;32mD:\\anconda\\lib\\urllib\\request.py:1349\u001b[0m, in \u001b[0;36mAbstractHTTPHandler.do_open\u001b[1;34m(self, http_class, req, **http_conn_args)\u001b[0m\n\u001b[0;32m   1346\u001b[0m         h\u001b[38;5;241m.\u001b[39mrequest(req\u001b[38;5;241m.\u001b[39mget_method(), req\u001b[38;5;241m.\u001b[39mselector, req\u001b[38;5;241m.\u001b[39mdata, headers,\n\u001b[0;32m   1347\u001b[0m                   encode_chunked\u001b[38;5;241m=\u001b[39mreq\u001b[38;5;241m.\u001b[39mhas_header(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mTransfer-encoding\u001b[39m\u001b[38;5;124m'\u001b[39m))\n\u001b[0;32m   1348\u001b[0m     \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mOSError\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m err: \u001b[38;5;66;03m# timeout error\u001b[39;00m\n\u001b[1;32m-> 1349\u001b[0m         \u001b[38;5;28;01mraise\u001b[39;00m URLError(err)\n\u001b[0;32m   1350\u001b[0m     r \u001b[38;5;241m=\u001b[39m h\u001b[38;5;241m.\u001b[39mgetresponse()\n\u001b[0;32m   1351\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m:\n",
      "\u001b[1;31mURLError\u001b[0m: <urlopen error [Errno 11001] getaddrinfo failed>"
     ]
    }
   ],
   "source": [
    "pd.read_html(\"https://docs.python.org/zh-cn/3/library/stdtypes.html#numeric-types-int-float-complex\")[2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "7dd3a793",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid character '：' (U+FF1A) (1071134580.py, line 1)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  Cell \u001b[1;32mIn [40], line 1\u001b[1;36m\u001b[0m\n\u001b[1;33m    运算\t结果：\t备注\t完整文档\u001b[0m\n\u001b[1;37m      \t  ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid character '：' (U+FF1A)\n"
     ]
    }
   ],
   "source": [
    "运算\t结果：\t备注\t完整文档\n",
    "0\tx + y\tx 和 y 的和\tNaN\tNaN\n",
    "1\tx - y\tx 和 y 的差\tNaN\tNaN\n",
    "2\tx * y\tx 和 y 的乘积\tNaN\tNaN\n",
    "3\tx / y\tx 和 y 的商\tNaN\tNaN\n",
    "4\tx // y\tx 和 y 的商数\t(1)\tNaN\n",
    "5\tx % y\tx / y 的余数\t(2)\tNaN\n",
    "6\t-x\tx 取反\tNaN\tNaN\n",
    "7\t+x\tx 不变\tNaN\tNaN\n",
    "8\tabs(x)\tx 的绝对值或大小\tNaN\tabs()\n",
    "9\tint(x)\t将 x 转换为整数\t(3)(6)\tint()\n",
    "10\tfloat(x)\t将 x 转换为浮点数\t(4)(6)\tfloat()\n",
    "11\tcomplex(re, im)\t一个带有实部 re 和虚部 im 的复数。im 默认为0。\t(6)\tcomplex()\n",
    "12\tc.conjugate()\t复数 c 的共轭\tNaN\tNaN\n",
    "13\tdivmod(x, y)\t(x // y, x % y)\t(2)\tdivmod()\n",
    "14\tpow(x, y)\tx 的 y 次幂\t(5)\tpow()\n",
    "15\tx ** y\tx 的 y 次幂\t(5)\tNaN"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "1e62569e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4.0"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "8/2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "bb78bf82",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4.25"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "17/4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "2681a4a9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "17//4 #取整数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "81eb683f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "17%5 #取余数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "38d48824",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "25"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "5**2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "7a60937b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2.23606797749979"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "5**(1/2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "3e722a58",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "2 % 3"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "38a94563",
   "metadata": {},
   "source": [
    "# 3.2 数值的一般方法（Methods）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "49d35bd6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "b'\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x04\\x00'"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(1024).to_bytes(10,byteorder='big') ##bytes 类型的数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "5a66f090",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(2.5).is_integer()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "d2e8e441",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "2.0.is_integer()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0b0a5d7d",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
